package com.struts.deal.user.manage.jlmanage;

import java.sql.Date;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import com.base.*;
import com.ibatis.po.corpor.TKindofcorporation;
import com.ibatis.po.system.TCiyt;
import com.ibatis.po.user.TEducation;
import com.ibatis.po.user.TTrainExperience;
import com.ibatis.po.user.TUser;
import com.ibatis.po.user.TUserInfo;
import com.ibatis.po.user.TUserSkill;
import com.ibatis.po.user.TVocation;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.lg.system.CSqlMap;
import com.lg.system.CTurnPage;
import com.lg.system.Common;
import com.struts.web.user.manage.jianli.FindJobForm;
import com.struts.web.user.manage.jianli.JlBaseInfoForm;
import com.struts.web.user.register.EducationTrainForm;

public class JlDeal extends BaseLog {

	/**
	 * 修改用户的基本信息
	 * @param request
	 * @param aWebForm
	 * @return
	 * @throws SQLException
	 */
    public static boolean editBaseInfo(HttpServletRequest request,JlBaseInfoForm aWebForm) throws SQLException {
    	boolean result = false;
    	TUser user = (TUser)request.getSession().getAttribute("TUser");
    	Date birth =null;
    	if(aWebForm.getBirthday()!=null && aWebForm.getBirthday().length()>0 ){
    	birth = Date.valueOf(aWebForm.getBirthday());//
    	}
    	String othernation = "";
    	if(aWebForm.getNation() !=null && aWebForm.getNation().equals("1") && aWebForm.getOthersnation()!=null && aWebForm.getOthersnation().length()>0){
    		othernation=aWebForm.getOthersnation();
    	}
    	user.setName(aWebForm.getName());
    	user.setSex(aWebForm.getSex());
    	user.setNation(aWebForm.getNation());
    	user.setOthersnation(othernation);
    	user.setBirthday(birth);
    	user.setIdcard(aWebForm.getIdcard());
    	user.setStature(aWebForm.getStature());
    	user.setMarriagestatus(aWebForm.getMarriageStatus());
    	user.setRegisteredaddress(aWebForm.getRegisteredAddress());
    	user.setNowaddress(aWebForm.getNowAddress());
    	user.setEducational(aWebForm.getEducation());
    	user.setWorkexperience(aWebForm.getWorkExperience());
    	user.setZyzc(aWebForm.getZyzc());
    	user.setTelephone(aWebForm.getTelephone());
    	user.setMobilephone(aWebForm.getMobilephone());
    	user.setQq(aWebForm.getQq());
    	user.setMsn(aWebForm.getMsn());
    	user.setEmail(aWebForm.getEmail());
    	user.setHomepage(aWebForm.getHomepage());
    	user.setComunicationaddress(aWebForm.getComunicationAddress());
    	user.setPostalcode(aWebForm.getPostalcode());
    	user.setLastmodifytime(new Timestamp(new java.util.Date().getTime()));
    	
    	SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
    	try{
    	if(user.getLoginname()!=null && user.getLoginname().length()>0){	
    	sqlmap.update("T_USER.abatorgenerated_updateByPrimaryKeySelective", user);
    	result = true;
    		}
    	}catch(Exception e){
    		e.printStackTrace();
    		}
    	return result;
    	
    }
    
    
    /**
	 * 职位搜索
	 * @param request
	 * @param aWebForm
	 * @return
	 * @throws SQLException
	 */
    public static void findJobQuery(HttpServletRequest request,FindJobForm aWebForm) throws SQLException {
    	TUserInfo user = (TUserInfo)request.getSession().getAttribute("TUser");
    	String userId = user.getId();
    	List cityList=null;
		List kindList=null; 
		SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
		TCiyt cityPo = new TCiyt();
		TKindofcorporation kindPo = new TKindofcorporation();
		String str="";
    	String str3="";
    	String sKey="";
        String sValue="";
        CTurnPage page = new CTurnPage();
		try{
			//企业性质
			
			str += "var kindId=new Array('','－－请选择性质－－'";
			kindList = sqlmap.queryForList("T_KINDOFCORPORATION.abatorgenerated_selectByExample");
			for(int i=0;i<kindList.size();i++){
				kindPo = (TKindofcorporation)kindList.get(i);
				sKey = kindPo.getId();
	        	sValue = kindPo.getKindOfName();
	        	str += ",'" + sKey + "',"; 
	            str += "'" + sValue + "'\n";
			}
			str += ");\n";
			
           //地区列表
	        str3 += "var address=new Array('','－－请选择地区－－'";
	        cityList = sqlmap.queryForList("T_CIYT.selectAllCity");
	        for(int i=0;i<cityList.size();i++){
	        	cityPo = (TCiyt)cityList.get(i);
	        	sKey = cityPo.getId();
	        	sValue = cityPo.getCityName();
	            if((Integer.parseInt(sKey)%100)==0){
	            str3 += ",'" + sKey + "',"; 
	            str3 += "'" + sValue + "'\n"; 
	            }else{
	            	 str3 += ",'" + sKey + "',"; 
	                 str3 += "'&nbsp;&nbsp;&nbsp;&nbsp;" + sValue + "'\n";
	            }
	        }
	        str3 += ");\n";
	        aWebForm.setPrintKindSql(str);
	        aWebForm.setPrintAddressSql(str3);
	        
	        if(aWebForm.getAddress()!=null && aWebForm.getAddress()!=""){
	        	int intAddr = Integer.parseInt(aWebForm.getAddress());
	        	if(intAddr%100==0){
	        		aWebForm.setAddressEnd(Integer.toString((intAddr+100)));
	        	}
	        }
	        page.setQueryList("T_CORPORATION.selectFindJob",aWebForm);
			page.setPerPageRows(10);
			page.excute(request);
			request.setAttribute("page", page);
		}catch(Exception e){
			e.printStackTrace();
		}
    	
    }
    
    
    /**
	 * 加载修改用户页面的基本信息
	 * @param request
	 * @param aWebForm
	 * @return
	 * @throws SQLException
	 */
    public static void setDefaultEditBaseInfo(HttpServletRequest request,JlBaseInfoForm aWebForm) throws SQLException {
    	
    	TUser user = (TUser)request.getSession().getAttribute("TUser");
    	List cityList=null;
    	TCiyt cityPo = new TCiyt();
    	SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
    	try{
    		cityList = sqlmap.queryForList("T_CIYT.selectAllCity");
        	String str="";
        	String str2="";
            String sKey="";
            String sValue="";
            
            str += "var regAddress=new Array('','－－请选择所在地－－'";
            str2 += "var nowAddr=new Array('','－－请选择所在地－－'";
            //户口所在地列表
            for(int i=0;i<cityList.size();i++){
            	cityPo = (TCiyt)cityList.get(i);
            	sKey = cityPo.getId();
            	sValue = cityPo.getCityName();
                if((Integer.parseInt(sKey)%100)==0){
                str += ",'" + sKey + "',"; //取出的TREEMAP的KEY
                str2+= ",'" + sKey + "',";
                str += "'" + sValue + "'\n"; //取出的TREEMAP的value
                str2 += "'" + sValue + "'\n";
                }else{
                	 str += ",'" + sKey + "',"; //取出的TREEMAP的KEY
                	 str2 += ",'" + sKey + "',";
                     str += "'&nbsp;&nbsp;&nbsp;&nbsp;" + sValue + "'\n"; //取出的TREEMAP的value
                     str2 += "'&nbsp;&nbsp;&nbsp;&nbsp;" + sValue + "'\n";
                }
            }
              str += ");\n";
              str2 += ");\n";
            //把部门数组输出到页面上
            aWebForm.setPrintRegSql(str);
            aWebForm.setPrintNowSql(str2);
            
    	user=(TUser)sqlmap.queryForObject("T_USER.abatorgenerated_selectByPrimaryKey",user);
    	SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    	String birth = df.format(user.getBirthday());
    	aWebForm.setName(user.getName());
    	aWebForm.setSex(user.getSex());
    	aWebForm.setNation(user.getNation());
    	aWebForm.setBirthday(birth);
    	aWebForm.setOthersnation(user.getOthersnation());
    	aWebForm.setIdcard(user.getIdcard());
    	aWebForm.setStature(user.getStature());
    	request.setAttribute("marriage", user.getMarriagestatus());
    	aWebForm.setMarriageStatus(user.getMarriagestatus());
    	request.setAttribute("registeredaddress", user.getRegisteredaddress());
    	aWebForm.setRegisteredAddress(user.getRegisteredaddress());
    	request.setAttribute("nowaddress", user.getNowaddress());
    	aWebForm.setNowAddress(user.getNowaddress());
    	request.setAttribute("education", user.getEducational());
    	aWebForm.setEducation(user.getEducational());
    	request.setAttribute("workexperience", user.getWorkexperience());
    	aWebForm.setWorkExperience(user.getWorkexperience());
    	aWebForm.setZyzc(user.getZyzc());
    	aWebForm.setTelephone(user.getTelephone());
    	aWebForm.setMobilephone(user.getMobilephone());
    	aWebForm.setQq(user.getQq());
    	aWebForm.setMsn(user.getMsn());
    	aWebForm.setEmail(user.getEmail());
    	aWebForm.setHomepage(user.getHomepage());
    	aWebForm.setComunicationAddress(user.getComunicationaddress());
    	aWebForm.setPostalcode(user.getPostalcode());
    	
    	}catch(Exception e){
    		e.printStackTrace();
    		}
    	
    }
    
    
    /**
	 * 加载职位搜索的信息 
	 * @param request
	 * @param aWebForm
	 * @return
	 * @throws SQLException
	 */
    public static void setDefaultFindJob(HttpServletRequest request,FindJobForm aWebForm) throws SQLException {
    	
    	TUserInfo user = (TUserInfo)request.getSession().getAttribute("TUser");
    	String userId = user.getId();
    	List cityList=null;
		List kindList=null; 
		SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
		TCiyt cityPo = new TCiyt();
		TKindofcorporation kindPo = new TKindofcorporation();
		String str="";
    	String str3="";
    	String sKey="";
        String sValue="";
        CTurnPage page = new CTurnPage();
		try{
			//企业性质
			str += "var kindId=new Array('','－－请选择性质－－'";
			kindList = sqlmap.queryForList("T_KINDOFCORPORATION.abatorgenerated_selectByExample");
			for(int i=0;i<kindList.size();i++){
				kindPo = (TKindofcorporation)kindList.get(i);
				sKey = kindPo.getId();
	        	sValue = kindPo.getKindOfName();
	        	str += ",'" + sKey + "',"; 
	            str += "'" + sValue + "'\n";
			}
			str += ");\n";
			
           //地区列表
	        str3 += "var address=new Array('','－－请选择地区－－'";
	        cityList = sqlmap.queryForList("T_CIYT.selectAllCity");
	        for(int i=0;i<cityList.size();i++){
	        	cityPo = (TCiyt)cityList.get(i);
	        	sKey = cityPo.getId();
	        	sValue = cityPo.getCityName();
	            if((Integer.parseInt(sKey)%100)==0){
	            str3 += ",'" + sKey + "',"; 
	            str3 += "'" + sValue + "'\n"; 
	            }else{
	            	 str3 += ",'" + sKey + "',"; 
	                 str3 += "'&nbsp;&nbsp;&nbsp;&nbsp;" + sValue + "'\n";
	            }
	        }
	        str3 += ");\n";
	        aWebForm.setPrintKindSql(str);
	        aWebForm.setPrintAddressSql(str3);
	        
	        page.setQueryList("T_CORPORATION.selectForFindJob",userId);
			page.setPerPageRows(10);
			page.excute(request);
			request.setAttribute("page", page);
		}catch(Exception e){
			e.printStackTrace();
		}
    	
    }
    
    
    /**
	 * 修改用户的教育信息
	 * @param request
	 * @param aWebForm
	 * @return
	 * @throws SQLException
	 */
    public static boolean editEducation(HttpServletRequest request,EducationTrainForm aWebForm) throws SQLException {
    	boolean result = false;
    	TUser user = (TUser)request.getSession().getAttribute("TUser");
    	TEducation tEducation1 = new TEducation();
    	TEducation tEducation2 = new TEducation();
    	TEducation tEducation3 = new TEducation();
    	
    	TTrainExperience train1 = new TTrainExperience();
    	TTrainExperience train2 = new TTrainExperience();
    	TTrainExperience train3 = new TTrainExperience();
    	
    	TUserSkill  userSkill = new TUserSkill();
    	SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
    	try{
    	String userid = user.getId();
    	if(aWebForm.getStartYear1()!=null && aWebForm.getStartYear1().length()>0){
    	tEducation1.setId(Common.getNewID());
    	tEducation1.setUserid(userid);
    	tEducation1.setStartYear(aWebForm.getStartYear1());
    	tEducation1.setStartMonth(aWebForm.getStartMonth1());
    	tEducation1.setEndYear(aWebForm.getEndYear1());
    	tEducation1.setEndMonth(aWebForm.getEndMonth1());
    	tEducation1.setSchoolName(aWebForm.getSchoolName1());
    	tEducation1.setSpeciality(aWebForm.getSpeciality1());
    	tEducation1.setDescriptionEducation(aWebForm.getDescriptionEducation1());
    	tEducation1.setXueLi(aWebForm.getXueLi1());
    	tEducation1.setOrderNum("1");
    	saveEducation(tEducation1);
    	
    	
    	    if(aWebForm.getStartYear2()!=null && aWebForm.getStartYear2().length()>0){
        	tEducation2.setId(Common.getNewID());
        	tEducation2.setUserid(userid);
        	tEducation2.setStartYear(aWebForm.getStartYear2());
        	tEducation2.setStartMonth(aWebForm.getStartMonth2());
        	tEducation2.setEndYear(aWebForm.getEndYear2());
        	tEducation2.setEndMonth(aWebForm.getEndMonth2());
        	tEducation2.setSchoolName(aWebForm.getSchoolName2());
        	tEducation2.setSpeciality(aWebForm.getSpeciality2());
        	tEducation2.setDescriptionEducation(aWebForm.getDescriptionEducation2());
        	tEducation2.setXueLi(aWebForm.getXueLi2());
        	tEducation2.setOrderNum("2");
        	saveEducation(tEducation2);
        	}
        	
        	if(aWebForm.getStartYear3()!=null && aWebForm.getStartYear3().length()>0){
        	tEducation3.setId(Common.getNewID());
        	tEducation3.setUserid(userid);
        	tEducation3.setStartYear(aWebForm.getStartYear3());
        	tEducation3.setStartMonth(aWebForm.getStartMonth3());
        	tEducation3.setEndYear(aWebForm.getEndYear3());
        	tEducation3.setEndMonth(aWebForm.getEndMonth1());
        	tEducation3.setSchoolName(aWebForm.getSchoolName3());
        	tEducation3.setSpeciality(aWebForm.getSpeciality3());
        	tEducation3.setDescriptionEducation(aWebForm.getDescriptionEducation3());
        	tEducation3.setXueLi(aWebForm.getXueLi3());
        	tEducation3.setOrderNum("3");
        	saveEducation(tEducation3);
        	}
    	}
    	
    	
    	
    	if(aWebForm.getTstartYear1()!=null && aWebForm.getTstartYear1().length()>0){
    	train1.setId(Common.getNewID());
    	train1.setUserid(userid);
    	train1.setTrainOrganization(aWebForm.getTtrainOrganize1());
    	train1.setTrainCourse(aWebForm.getTtrainCource1());
    	train1.setCertificate(aWebForm.getTcertificate1());
    	train1.setStartYear(aWebForm.getTstartYear1());
    	train1.setStartMonth(aWebForm.getTstartMonth1());
    	train1.setEndYear(aWebForm.getTendYear1());
    	train1.setEndMonth(aWebForm.getTendMonth1());
    	train1.setOrderNum("1");
    	saveTrain(train1);//更新或插入
    	
    	    if(aWebForm.getTstartYear2()!=null && aWebForm.getTstartYear2().length()>0){
        	train2.setId(Common.getNewID());
        	train2.setUserid(userid);
        	train2.setTrainOrganization(aWebForm.getTtrainOrganize2());
        	train2.setTrainCourse(aWebForm.getTtrainCource2());
        	train2.setCertificate(aWebForm.getTcertificate2());
        	train2.setStartYear(aWebForm.getTstartYear2());
        	train2.setStartMonth(aWebForm.getTstartMonth2());
        	train2.setEndYear(aWebForm.getTendYear2());
        	train2.setEndMonth(aWebForm.getTendMonth2());
        	train2.setOrderNum("2");
        	saveTrain(train2);//更新或插入
        	}
        	
        	if(aWebForm.getTstartYear3()!=null && aWebForm.getTstartYear3().length()>0){
        	train3.setId(Common.getNewID());
        	train3.setUserid(userid);
        	train3.setTrainOrganization(aWebForm.getTtrainOrganize3());
        	train3.setTrainCourse(aWebForm.getTtrainCource3());
        	train3.setCertificate(aWebForm.getTcertificate3());
        	train3.setStartYear(aWebForm.getTstartYear3());
        	train3.setStartMonth(aWebForm.getTstartMonth3());
        	train3.setEndYear(aWebForm.getTendYear3());
        	train3.setEndMonth(aWebForm.getTendMonth3());
        	train3.setOrderNum("3");
        	saveTrain(train3);//更新或插入
        	}
    	}
    	
    	
    	
    	int count = 0;
    	userSkill.setId(Common.getNewID());
    	userSkill.setUserid(userid);
    	userSkill.setMandarin(aWebForm.getMandarin());
    	userSkill.setCantonese(aWebForm.getCantonese());
    	userSkill.setEnglish(aWebForm.getEnglish());
    	userSkill.setEnglishLevel(aWebForm.getEnglishLevel());
    	userSkill.setOtherLanguage(aWebForm.getOtherLanguage());
    	userSkill.setSkillDescription(aWebForm.getSkillDescription());
    	userSkill.setComputer(aWebForm.getComputer());
    	userSkill.setOtherLanguageLevel(aWebForm.getOtherLanguageLevel());
    	count = (Integer) sqlmap.queryForObject("T_USER_SKILL.selectByUserId",userSkill);
    	if(count>0){
    		sqlmap.update("T_USER_SKILL.updateByUserId",userSkill);
    	}else{
    	    sqlmap.insert("T_USER_SKILL.abatorgenerated_insert", userSkill); 
    	}
    	}catch(Exception e){
    		e.printStackTrace();
    		}
    	return result;
    	
    }
    
    /**
	 * 加载修改用户页面的教育信息
	 * @param request
	 * @param aWebForm
	 * @return
	 * @throws SQLException
	 */
    public static void setDefaultEditEducation(HttpServletRequest request,EducationTrainForm aWebForm) throws SQLException {
    	
    	TUser user = (TUser)request.getSession().getAttribute("TUser");
    	List educationList = null;
    	
    	List trainList = null;
    	
    	TUserSkill  userSkill = new TUserSkill();
    	SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
    	try{
    	String userid = user.getId();
    	educationList = sqlmap.queryForList("T_EDUCATION.selectByUserId",userid);
    	for(int i=0;i<educationList.size();i++){
    		TEducation tEducation = (TEducation)educationList.get(i);
    		String  order = tEducation.getOrderNum();
    		if(order.equals("1")){
    			aWebForm.setStartYear1(tEducation.getStartYear());
    			aWebForm.setStartMonth1(tEducation.getStartMonth());
    			aWebForm.setEndYear1(tEducation.getEndYear());
    			aWebForm.setEndMonth1(tEducation.getEndMonth());
    			aWebForm.setDescriptionEducation1(tEducation.getDescriptionEducation());
    			aWebForm.setSchoolName1(tEducation.getSchoolName());
    			aWebForm.setSpeciality1(tEducation.getSpeciality());
    			aWebForm.setXueLi1(tEducation.getXueLi());
    		}
    		if(order.equals("2")){
    			aWebForm.setStartYear2(tEducation.getStartYear());
    			aWebForm.setStartMonth2(tEducation.getStartMonth());
    			aWebForm.setEndYear2(tEducation.getEndYear());
    			aWebForm.setEndMonth2(tEducation.getEndMonth());
    			aWebForm.setDescriptionEducation2(tEducation.getDescriptionEducation());
    			aWebForm.setSchoolName2(tEducation.getSchoolName());
    			aWebForm.setSpeciality2(tEducation.getSpeciality());
    			aWebForm.setXueLi2(tEducation.getXueLi());
    		}
    		if(order.equals("3")){
    			aWebForm.setStartYear3(tEducation.getStartYear());
    			aWebForm.setStartMonth3(tEducation.getStartMonth());
    			aWebForm.setEndYear3(tEducation.getEndYear());
    			aWebForm.setEndMonth3(tEducation.getEndMonth());
    			aWebForm.setDescriptionEducation3(tEducation.getDescriptionEducation());
    			aWebForm.setSchoolName3(tEducation.getSchoolName());
    			aWebForm.setSpeciality3(tEducation.getSpeciality());
    			aWebForm.setXueLi3(tEducation.getXueLi());
    		}
    	}
    	
    	
    	trainList = sqlmap.queryForList("T_TRAIN_EXPERIENCE.selectByUserId",userid);
    	for(int i=0;i<trainList.size();i++){
    		TTrainExperience train = (TTrainExperience)trainList.get(i);
    		String order = train.getOrderNum();
    		if(order.equals("1")){
    			aWebForm.setTstartYear1(train.getStartYear());
    			aWebForm.setTstartMonth1(train.getStartMonth());
    			aWebForm.setTendYear1(train.getEndYear());
    			aWebForm.setTendMonth1(train.getEndMonth());
    			aWebForm.setTcertificate1(train.getCertificate());
    			aWebForm.setTtrainCource1(train.getTrainCourse());
    			aWebForm.setTtrainOrganize1(train.getTrainOrganization());
    		}
    		if(order.equals("2")){
    			aWebForm.setTstartYear2(train.getStartYear());
    			aWebForm.setTstartMonth2(train.getStartMonth());
    			aWebForm.setTendYear2(train.getEndYear());
    			aWebForm.setTendMonth2(train.getEndMonth());
    			aWebForm.setTcertificate2(train.getCertificate());
    			aWebForm.setTtrainCource2(train.getTrainCourse());
    			aWebForm.setTtrainOrganize2(train.getTrainOrganization());
    		}
    		if(order.equals("2")){
    			aWebForm.setTstartYear3(train.getStartYear());
    			aWebForm.setTstartMonth3(train.getStartMonth());
    			aWebForm.setTendYear3(train.getEndYear());
    			aWebForm.setTendMonth3(train.getEndMonth());
    			aWebForm.setTcertificate3(train.getCertificate());
    			aWebForm.setTtrainCource3(train.getTrainCourse());
    			aWebForm.setTtrainOrganize3(train.getTrainOrganization());
    		}
    	}
    	userSkill = (TUserSkill)sqlmap.queryForObject("T_USER_SKILL.selectByTheUserId",userid);
    	aWebForm.setCantonese(userSkill.getCantonese());
    	aWebForm.setComputer(userSkill.getComputer());
    	aWebForm.setEnglish(userSkill.getEnglish());
    	aWebForm.setEnglishLevel(userSkill.getEnglishLevel());
    	aWebForm.setMandarin(userSkill.getMandarin());
    	aWebForm.setSkillDescription(userSkill.getSkillDescription());
    	aWebForm.setOtherLanguage(userSkill.getOtherLanguage());
    	}catch(Exception e){
    		e.printStackTrace();
    		}
    	
    }
    
//  对社会经历表进行操作
    public static  void  saveTrain(TTrainExperience train) throws SQLException {
    	SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
    	int count= 0;
    	try{
    		count = ((Integer)sqlmap.queryForObject("T_TRAIN_EXPERIENCE.selectByUseridOrer", train)).intValue();
    		if(count>0){
        		sqlmap.update("T_TRAIN_EXPERIENCE.updateByUserId", train);
        	}else{
        	  sqlmap.insert("T_TRAIN_EXPERIENCE.abatorgenerated_insert", train);
        	}
    	}catch(Exception e){
    		e.printStackTrace();
    		}
    	
    }
    
    /**
     * 对教育表进行操作
     * @param train
     * @throws SQLException
     */
    public static  void  saveEducation(TEducation education) throws SQLException {
    	SqlMapClient sqlmap = CSqlMap.getSqlMapConfig();
    	int count= 0;
    	try{
    		count = ((Integer)sqlmap.queryForObject("T_EDUCATION.selectByUseridOrder", education)).intValue();
    		if(count>0){
        		sqlmap.update("T_EDUCATION.updateByUseridOrder", education);
        	}else{
        	  sqlmap.insert("T_EDUCATION.abatorgenerated_insert", education);
        	}
    	}catch(Exception e){
    		e.printStackTrace();
    		}
    	
    }
}
